qui(function(require, exports, module) {

    Server.Config = $.extend({}, Ancestor.Config, {



        SERVER_STATUS: ['下线', '上线','测试'],
        SERVER_TYPE: ['PGC直转点','UDI','UGC直转点','测试','轮播台','视频包装系统','秀场服务','直播编码','直播收录','直转点','直转点列表','导播台','新收录','包装系统-直转点','包装系统-导播台'],
        ZZD_SERVER_STATUS: ['服务异常','版本缺失','正常','版本不同'],
        INCLUDE_TYPE : 12,


        REGION_CH_LIST: [],
        PageBean: null,
        URL_PRE : 'http://',
        URL_POST : ':8080/version',

        VERSION_IND : {
            'zzdVersion': 3,
            'encoderVersion': 4,
            'mergeToolVersion': 5,
            'mergeServiceVersion': 6,
            'precisionCutToolVersion': 7,
            'hardware':0,
            'serverStatus':2,
            'versionStatus':1
        },

        validator: {
            messages: {
                sn: {
                    required: "序列号不能为空",
                },
                insideServerIp: {
                    required: "内网IP不能为空",
                },
                status: {
                    required: '服务器状态不能为空',
                },
                serverType: {
                    required: '服务器类型不能为空',
                },
                idc: {
                    required: '机房不能为空',
                },
                system: {
                    required: '系统不能为空',
                },
                including: {
                    required: '最大收录数不能为空',
                }
            },
            rules: {
                sn: {
                    required: true,
                },
                insideServerIp: {
                    required: true,
                },
                status: {
                    required: true,
                },
                serverType: {
                    required: true,
                },
                idc: {
                    required: true,
                },
                system: {
                    required: true,
                },
                including:{
                    required: true,
                }
            }
        },

			TABLE_COLMODEL_CONFIG: {
			    'sn': {
                    name: 'sn',
                    title: false,
                    index: 'sn',
                    align:'center',
                    sortable: false,
                    width: 90
                },
				'insideServerIp': {
					name: 'insideServerIp',
					title: false,
					index: 'insideServerIp',
					align:'center',
					sortable: false,
					width: 90,
                    formatter: function(v, o, r) {
                        return Server.Util.formatter.IPtoHubble(v,r);
                    }
				},
				'outsideServerIp': {
					name: 'outsideServerIp',
					title: false,
					index: 'outsideServerIp',
					align:'center',
					sortable: false,
					width: 90
				},
				'port': {
					name: 'port',
					title: false,
					index: 'port',
					align:'center',
					sortable: false,
					width: 50
				},
				'serverType': {
                    name: 'serverType',
                    title: false,
                    index: 'serverType',
                    align:'center',
                    sortable: false,
                    width: 100,
                    align: 'center',
                    formatter: function(v, o, r) {
                        return Server.Util.formatter.serverType(v,r);
                    }
                },
                'idc': {
                    name: 'idc',
                    title: false,
                    index: 'idc',
                    align:'center',
                    sortable: false,
                    width: 120,
                    align: 'center',
                },

                'cluster_name': {
                    name: 'cluster_name',
                    title: false,
                    index: 'cluster_name',
                    align:'center',
                    sortable: false,
                    width: 120,
                    align: 'center',
                    formatter: function(v, o, r) {
                        return Server.Util.formatClusterName(v,r);
                    }
                },
                /*
                'province': {
                    name: 'province',
                    title: false,
                    index: 'province',
                    align:'center',
                    sortable: false,
                    width: 100
                },
                'city': {
                    name: 'city',
                    title: false,
                    index: 'city',
                    align:'center',
                    sortable: false,
                    width: 100
                },
                */
                'system': {
                    name: 'system',
                    title: false,
                    index: 'system',
                    align:'center',
                    sortable: false,
                    width: 80
                },
                'hardware': {
                    name: 'hardware',
                    title: false,
                    index: 'hardware',
                    align:'center',
                    sortable: false,
                    width: 80
                },
				'status': {
					name: 'status',
					title: false,
					index: 'status',
					align:'center',
					width: 50,
					sortable: false,
					formatter: function(v, o, r) {
						return Server.Util.formatter.status(v,r);
					}
				},

				'remark': {
					name: 'remark',
					title: false,
					index: 'remark',
					align:'center',
					width: 100,
					sortable: false,
					align: 'center'
				},
				'operate': {
					name: 'operate',
					title: false,
					index: 'operate',
					width: 80,
					align:'center',
					sortable: false,
					formatter: function(v, o, r) {
						return Server.Util.formatter.operate(v,r);
					}
				},
                'details': {
                    name: 'details',
                    title: false,
                    index: 'details',
                    width: 55,
                    align:'center',
                    sortable: false,
                    formatter: function(v, o, r) {
                        return Server.Util.formatter.details(v,r);
                    }
                },

                'load': {
                    name: 'load',
                    title: false,
                    index: 'load',
                    width: 50,
                    align:'center',
                    sortable: true,
                    hidden:true
                },

                'dataFreePer': {
                    name: 'dataFreePer',
                    title: false,
                    index: 'dataFreePer',
                    width: 80,
                    align:'center',
                    sortable: true,
                    hidden:true,
                    formatter: function(v, o, r) {
                        return Server.Util.formatter.formatPer(v,r);
                    }
                },

                'allFreePer': {
                    name: 'allFreePer',
                    title: false,
                    index: 'allFreePer',
                    width: 80,
                    align:'center',
                    sortable: true,
                    hidden:true,
                    formatter: function(v, o, r) {
                        return Server.Util.formatter.formatPer(v,r);
                    }
                },


                'availableMemPer': {
                    name: 'availableMemPer',
                    title: false,
                    index: 'availableMemPer',
                    width: 80,
                    align:'center',
                    sortable: true,
                    hidden:true,
                    formatter: function(v, o, r) {
                        return Server.Util.formatter.formatPer(v,r);
                    }
                },


                'freeSwapPer': {
                    name: 'freeSwapPer',
                    title: false,
                    index: 'freeSwapPer',
                    width: 100,
                    align:'center',
                    sortable: true,
                    hidden:true,
                    formatter: function(v, o, r) {
                        return Server.Util.formatter.formatPer(v,r);
                    }
                },

                'inIcmploss': {
                    name: 'inIcmploss',
                    title: false,
                    index: 'inIcmploss',
                    width: 100,
                    align:'center',
                    sortable: true,
                    //hidden:true,
                    formatter: function(v, o, r) {
                        return Server.Util.formatter.formatLoss(v,r);
                    }
                },

                'outIcmploss': {
                    name: 'outIcmploss',
                    title: false,
                    index: 'outIcmploss',
                    width: 100,
                    align:'center',
                    sortable: true,
                    hidden:true,
                    formatter: function(v, o, r) {
                        return Server.Util.formatter.formatLoss(v,r);
                    }
                },
                'disk': {
                    name: 'disk',
                    title: false,
                    index: 'disk',
                    width: 100,
                    align:'center',
                    sortable: false
                },
                'monitor': {
                    name: 'monitor',
                    title: false,
                    index: 'monitor',
                    width: 80,
                    align:'center',
                    sortable: false,
                    formatter: function(v, o, r) {
                        return Server.Util.formatter.formatMonitor(v,r);
                    }
                },
                'men': {
                    name: 'men',
                    title: false,
                    index: 'men',
                    width: 100,
                    align:'center',
                    sortable: false
                },
                'networkStatus': {
                    name: 'networkStatus',
                    title: false,
                    index: 'networkStatus',
                    width: 100,
                    align:'center',
                    sortable: false,
                    formatter: function(v, o, r) {
                        return Server.Util.formatter.networkStatus(v,r);
                    }
                },
                'addTime': {
                    name: 'addTime',
                    title: false,
                    index: 'addTime',
                    align:'center',
                    width: 100,
                    sortable: false,
                    align: 'center',
                    formatter: function(v, o, r) {
                        return Server.Util.formatter.time(v,r);
                    }
                },

			},

            TABLE_VERSION_COLMODEL_CONFIG: {
                //colModel: ["serverId","insideServerIp","outsideIp","zzdVersion","encoderVersion","mergeToolVersion","mergeServiceVersion","precisionCutToolVersion","hardware","serverStatus","updateTime",'detail'],
                'serverId': {
                    name: 'serverId',
                    title: false,
                    index: 'serverId',
                    align:'center',
                    sortable: false,
                    width: 80,
                    formatter: function(v, o, r) {
                        return Server.Util.formatter.id(v,r);
                    }
                },

                'insideServerIp': {
                    name: 'insideServerIp',
                    title: false,
                    index: 'insideServerIp',
                    align:'center',
                    sortable: false,
                    width: 100,
                    formatter: function(v, o, r) {
                        return Server.Util.formatter.insideServerIp(v,r);
                    }
                },

                'outsideIp': {
                    name: 'outsideIp',
                    title: false,
                    index: 'outsideIp',
                    align:'center',
                    sortable: false,
                    width: 100
                },

                'zzdVersion': {
                    name: 'zzdVersion',
                    title: false,
                    index: 'zzdVersion',
                    width: 100,
                    align:'center',
                    sortable: false
                },

                'hardware': {
                    name: 'hardware',
                    title: false,
                    index: 'hardware',
                    width: 100,
                    align:'center',
                    sortable: false
                },

                'encoderVersion': {
                    name: 'encoderVersion',
                    title: false,
                    index: 'encoderVersion',
                    width: 100,
                    align:'center',
                    sortable: false
                },
                'mergeToolVersion': {
                    name: 'mergeToolVersion',
                    title: false,
                    index: 'mergeToolVersion',
                    width: 100,
                    align:'center',
                    sortable: false
                },
                'mergeServiceVersion': {
                    name: 'mergeServiceVersion',
                    title: false,
                    index: 'mergeServiceVersion',
                    width: 100,
                    align:'center',
                    sortable: false
                },
                'precisionCutToolVersion': {
                    name: 'precisionCutToolVersion',
                    title: false,
                    index: 'precisionCutToolVersion',
                    width: 140,
                    align:'center',
                    sortable: false
                },
                'serverStatus': {
                    name: 'serverStatus',
                    title: false,
                    index: 'serverStatus',
                    width: 100,
                    align:'center',
                    sortable: false,
                    formatter: function(v, o, r) {
                        return Server.Util.formatter.zzd_status(v,r);
                    }
                },
                'updateTime': {
                    name: 'updateTime',
                    title: false,
                    index: 'updateTime',
                    width: 130,
                    align:'center',
                    sortable: false,
                    formatter: function(v, o, r) {
                        return Server.Util.formatter.time(v,r);
                    }
                },

                'remark': {
                    name: 'remark',
                    title: false,
                    index: 'remark',
                    width: 140,
                    align:'center',
                    sortable: false,
                },

                'status': {
                    name: 'status',
                    title: false,
                    index: 'status',
                    align:'center',
                    width: 100,
                    sortable: false,
                    formatter: function(v, o, r) {
                        return Server.Util.formatter.status(v,r);
                    }
                },

                'detail': {
                    name: 'insideServerIp',
                    title: false,
                    index: 'insideServerIp',
                    width: 90,
                    align:'center',
                    sortable: false,
                    formatter: function(v, o, r) {
                        return Server.Util.formatter.detail(v,r);
                    }
                },
            },

            TABLE_STATUS_COLMODEL_CONFIG: {
                'addTime': {
                    name: 'addTime',
                    title: false,
                    index: 'addTime',
                    align:'center',
                    width: 100,
                    sortable: false,
                    align: 'center',
                    formatter: function(v, o, r) {
                        return Server.Util.formatter.time(v,r);
                    }
                },
                'load': {
                    name: 'load',
                    title: false,
                    index: 'load',
                    width: 50,
                    align:'center',
                    sortable: false
                },

                'dataFreePer': {
                    name: 'dataFreePer',
                    title: false,
                    index: 'dataFreePer',
                    width: 80,
                    align:'center',
                    sortable: false,
                    formatter: function(v, o, r) {
                        return Server.Util.formatter.formatPer(v,r);
                    }
                },

                'allFreePer': {
                    name: 'allFreePer',
                    title: false,
                    index: 'allFreePer',
                    width: 80,
                    align:'center',
                    sortable: false,
                    formatter: function(v, o, r) {
                        return Server.Util.formatter.formatPer(v,r);
                    }
                },


                'availableMemPer': {
                    name: 'availableMemPer',
                    title: false,
                    index: 'availableMemPer',
                    width: 80,
                    align:'center',
                    sortable: false,
                    formatter: function(v, o, r) {
                        return Server.Util.formatter.formatPer(v,r);
                    }
                },


                'freeSwapPer': {
                    name: 'freeSwapPer',
                    title: false,
                    index: 'freeSwapPer',
                    width: 100,
                    align:'center',
                    sortable: false,
                    formatter: function(v, o, r) {
                        return Server.Util.formatter.formatPer(v,r);
                    }
                },

                'inIcmploss': {
                    name: 'inIcmploss',
                    title: false,
                    index: 'inIcmploss',
                    width: 100,
                    align:'center',
                    sortable: false,
                    formatter: function(v, o, r) {
                        return Server.Util.formatter.formatLoss(v,r);
                    }
                },

                'outIcmploss': {
                    name: 'outIcmploss',
                    title: false,
                    index: 'outIcmploss',
                    width: 100,
                    align:'center',
                    sortable: false,
                    formatter: function(v, o, r) {
                        return Server.Util.formatter.formatLoss(v,r);
                    }
                },
            },


			TABLE: {
			    url: "/api/sginal/server/list",
			    rowNum: 50,
                pager: "#ServerListPager",
			    multiselect: false,
			    prmNames: {
                    page: "pageNo",
                    rows: "pageSize",
                    sort: 'OrderBy',
                    order: 'Sort'
                },

			    loadBeforeSend:function(xhr, settings){
                    var auth = Ancestor.Util.getAuth("/sginal/server/list");
                    xhr.setRequestHeader('Sign',auth.sign);
                    xhr.setRequestHeader("Time",auth.clientTime);
                    xhr.setRequestHeader("From",auth.from);
                    return true;
                },

			    //datatype: "local",
			    loadtext: '加载中...',
                loadui: "block",
                mtype: "post",
                loadonce: false,
                sortname:'load',
                sortorder:'none',


				colNames: ["序列号", "内网IP","外网IP", "端口号", "业务","集群", "机房", /*"省份", "市区",*/ "系统", "硬件", "描述", "状态","load","/data free","/ free","可用内存","swap空闲比","内icmploss","外icmploss", "详情","监控", "操作"],
				colModel: ['sn', 'insideServerIp','outsideServerIp', 'port', 'serverType','cluster_name',  'idc', /*'province', 'city', */'system','hardware', 'remark', 'status','load','dataFreePer','allFreePer','availableMemPer','freeSwapPer','inIcmploss','outIcmploss','details','monitor', 'operate' ]
			},


            TABLE_STATUS: {
                url: "/api/sginal/server/status/list",
                rowNum: 20,
                pager: "#status_pager",
                multiselect: false,
                prmNames: {
                    page: "pageNo",
                    rows: "pageSize"
                },

                loadBeforeSend:function(xhr, settings){
                    var auth = Ancestor.Util.getAuth("/sginal/server/status/list");
                    xhr.setRequestHeader('Sign',auth.sign);
                    xhr.setRequestHeader("Time",auth.clientTime);
                    xhr.setRequestHeader("From",auth.from);
                    return true;
                },

                //datatype: "local",
                loadtext: '加载中...',
                loadui: "block",
                mtype: "post",
                sortname:[],

                colNames: ["获取时间", "load","/data free","/ free","可用内存","swap空闲比","内icmploss","外icmploss"],
                colModel: ['addTime','load' ,'dataFreePer','allFreePer','availableMemPer','freeSwapPer','inIcmploss','outIcmploss']
            },

            TABLE_zzdServer: {
                url: "/api/sginal/server/zzdServerList",
                rowNum: 100,
                pager: "#VersionListPager",
                multiselect: false,
                prmNames: {
                    page: "pageNo",
                    rows: "pageSize"
                },

                loadBeforeSend:function(xhr, settings){
                    var auth = Ancestor.Util.getAuth("/sginal/server/zzdServerList");
                    xhr.setRequestHeader('Sign',auth.sign);
                    xhr.setRequestHeader("Time",auth.clientTime);
                    xhr.setRequestHeader("From",auth.from);
                    return true;
                },

                //datatype: "local",
                loadtext: '加载中...',
                loadui: "block",
                mtype: "post",

                colNames: ["ID","内网ip","外网ip","直转点版本号","编码器版本号","合并工具版本号","合并服务版本号","精确化裁剪工具版本号","硬件" ,"版本状态", "更新时间","描述","服务状态","详细"],
                colModel: ["serverId","insideServerIp","outsideIp","zzdVersion","encoderVersion","mergeToolVersion","mergeServiceVersion","precisionCutToolVersion","hardware","serverStatus","updateTime","remark","status","detail"],
            },











            CLUSTER_STATUS: ['下线', '上线'],
            clusterValidator: {
                errorClass: 'invalid-msg',
                highlight: function(element, errorClass) {
                    $(element).addClass('invalid-field');
                },
                unhighlight: function(element, errorClass) {
                    $(element).removeClass('invalid-field');
                },
            messages: {
                name: {
                    required: "集群名称不能为空",
                },
                status: {
                    required: '集群状态不能为空',
                },
                idc: {
                    required: '机房不能为空',
                },
            },
            rules: {
                name: {
                    required: true,
                },
                status: {
                    required: true,
                },
                idc: {
                    required: true,
                },
            }

        },

            TABLE_SERVER_IDCSERVER_COLMODEL_CONFIG: {
                'cluster_name':{
                    name: 'cluster_name',
                    title: false,
                    index: 'cluster_name',
                    align:'center',
                    width: 100,
                    sortable: false,
                    align: 'center',
                    formatter: function(v, o, r) {
                        return Server.Util.formatClusterName(v,r);
                    }
                },

                'insideServerIp': {
                    name: 'insideServerIp',
                    title: false,
                    index: 'insideServerIp',
                    align:'center',
                    width: 100,
                    sortable: false,
                    align: 'center',
                },
                'including': {
                    name: 'including',
                    title: false,
                    index: 'including',
                    width: 100,
                    align:'center',
                    sortable: false
                },
            },

            TABLE_SERVER_CLUSTER_COLMODEL_CONFIG: {
            'id':{
                name: 'id',
                title: false,
                index: 'id',
                align:'center',
                width: 100,
                sortable: false,
                align: 'center',
            },

            'name': {
                name: 'name',
                title: false,
                index: 'name',
                align:'center',
                width: 100,
                sortable: false,
                align: 'center',
            },
            'including': {
                name: 'including',
                title: false,
                index: 'including',
                width: 100,
                align:'center',
                sortable: false
            },

            'serverNum': {
                name: 'serverNum',
                title: false,
                index: 'serverNum',
                width: 100,
                align:'center',
                sortable: false
            },

            'user': {
                name: 'user',
                title: false,
                index: 'user',
                width: 100,
                align:'center',
                sortable: false,
                formatter: function(v, o, r) {
                    return Server.Util.formatUser(v,r);
                }
            },

            'addTime': {
                name: 'addTime',
                title: false,
                index: 'addTime',
                width: 150,
                align:'center',
                sortable: false
            },

            'status': {
                name: 'status',
                title: false,
                index: 'status',
                width: 100,
                align:'center',
                sortable: false,
                formatter: function(v, o, r) {
                    return Server.Util.formatClusterStatus(v,r);
                }
            },

            'operate': {
                name: 'operate',
                title: false,
                index: 'operate',
                width: 130,
                align:'center',
                sortable: false,
                formatter: function(v, o, r) {
                    return Server.Util.formatOpt(v,r);
                }
            },
        },

            TABLE_SERVER_IDCSERVER: {
                url: "/api/sginal/server/idcServerList",
                multiselect: true,
                rowNum: 300,
                height:400,

                prmNames: {
                    page: "pageNo",
                    rows: "pageSize"
                },

                loadBeforeSend:function(xhr, settings){
                    var auth = Ancestor.Util.getAuth("/sginal/server/idcServerList");
                    xhr.setRequestHeader('Sign',auth.sign);
                    xhr.setRequestHeader("Time",auth.clientTime);
                    xhr.setRequestHeader("From",auth.from);
                    return true;
                },

                //datatype: "local",
                loadtext: '加载中...',
                loadui: "block",
                mtype: "post",

                colNames: ["IP","最大收录数","已分配集群"],
                colModel: ["insideServerIp","including","cluster_name"],
            },


            TABLE_SERVER_CLUSTER: {
                url: "/api/sginal/server/clusterList",
                rowNum: 20,
                pager: "#ClusterListPager",
                multiselect: false,
                prmNames: {
                    page: "pageNo",
                    rows: "pageSize"
                },

                loadBeforeSend:function(xhr, settings){
                    var auth = Ancestor.Util.getAuth("/sginal/server/clusterList");
                    xhr.setRequestHeader('Sign',auth.sign);
                    xhr.setRequestHeader("Time",auth.clientTime);
                    xhr.setRequestHeader("From",auth.from);
                    return true;
                },

                loadtext: '加载中...',
                loadui: "block",
                mtype: "post",

                colNames: ["服务器集群ID","服务器集群","服务器数量","已收录信号数","状态","创建人","创建时间","操作"],
                colModel: ["id","name","serverNum","including","status","user","addTime","operate"],
            },

		});
});